package tv.drplay.course.crash

import android.app.Application
import java.lang.Exception
import java.lang.Thread.UncaughtExceptionHandler

class CrashHandler(private val app: Application) : UncaughtExceptionHandler {

    override fun uncaughtException(t: Thread?, e: Throwable?) {
        e?: return
        CrashReport.reportException(e)
        try {
            Thread.sleep(5000)
            android.os.Process.killProcess(android.os.Process.myPid())
        }catch (e: Exception) {
            e.printStackTrace()
        }
    }
}